$(function(){
    resetCorner();
    $('#menu > ul > li').each(function(){
        var $li = $(this)
        if($li.attr('class').indexOf('curr')==-1){
            $li.hover(
                function(){
                    $li.addClass("cn_t3 hover");
                    resetCorner();
                },
                function(){
                    $li.removeClass("cn_t3 hover");
                    resetCorner();
                }
            )
        }
    })
    $(".list1").mouseover(function() {
        $(this).addClass('list1_hover');
    }).mouseout(function(){
        $(this).removeClass('list1_hover');
    });
})
var resetCorner = function(){
    $('.cn').corner( "5px");
    $('.cn_l5').corner( "left 5px");
    $('.cn_r5').corner( "right 5px");
    $('.cn_t5').corner( "top 5px");
    $('.cn_b5').corner( "bottom 5px");
    $('.cn_l3').corner( "left 3px");
    $('.cn_r3').corner( "right 3px");
    $('.cn_t3').corner( "top 3px");
    $('.cn_b3').corner( "bottom 3px");
}
var selTopCity = function(obj){
    if($(obj).val()!=''){
        $.getJSON('/xhr_get_sub_cities', {
            'parent_id': $(obj).val()
            }, function(data){
            var sub_cities = data.sub_cities;
            var html = sub_cities.length==1 ? '': '<option></option>'
            for(var i=0;i<sub_cities.length;i++){
                html += '<option value='+sub_cities[i].id+'>'+sub_cities[i].name+'</option>'
            }
            $(obj).next().html(html)
            $(obj).next().removeAttr('disabled')
        })
    }else{
        $(obj).next().html('')
        $(obj).next().attr('disabled', true)
    }
}